<include file="public/layout" />

<script src="__ROOT__/public/static/js/layer/laydate/laydate.js"></script>

<body style="background-color: #FFF; overflow: auto;">

<div id="toolTipLayer" style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>

<div id="append_parent"></div>

<div id="ajaxwaitid"></div>

<div class="page">

    <div class="fixed-bar">

        <div class="item-title"><a class="back" href="javascript:history.back();" title="返回列表"><i class="fa fa-arrow-circle-o-left"></i></a>

            <div class="subject">

                <h3>优惠券管理 - 编辑优惠券</h3>

                <h5>网站系统优惠券管理</h5>

            </div>

        </div>

    </div>

    <form class="form-horizontal" id="handleposition" method="post">

        <input type="hidden" name="id" value="{$coupon.id}"/>

        <div class="ncap-form-default">
            <dl class="row">
                <dt class="tit">
                    <label>供应商</label>
                </dt>
                <dd class="opt">
                    <div class="sDiv2">
                        <if condition="$suppliers_id">
                            <select name="suppliers" class="small form-control">
                                <option value="{$suppliers_id.suppliers_id}">{$suppliers_id.suppliers_name}</option>
                            </select>
                            <else/>
                            <select name="suppliers" class="small form-control">
                                <option value="0">请选择供应商</option>
                                <volist name="suppliers" id="vo">
                                    <option <if condition="$vo['suppliers_id'] eq $coupon['suppliers_id']">selected</if> value="{$vo.suppliers_id}">{$vo.suppliers_name}</option>
                                </volist>
                            </select>
                        </if>
                    </div>
                </dd>
            </dl>



            <dl class="row">

                <dt class="tit">

                    <label><em>*</em>优惠券名称</label>

                </dt>

                <dd class="opt">

                    <input type="text" id="name" name="name" value="{$coupon.name}" class="input-txt">

                    <p class="notic">请填写优惠券名称</p>

                </dd>

            </dl>

            <dl class="row">

                <dt class="tit">

                    <label><em>*</em>优惠券面额</label>

                </dt>

                <dd class="opt">

                    <input type="text" id="money" name="money"  onpaste="this.value=this.value.replace(/[^\d.]/g,'')" onkeyup="this.value=this.value.replace(/[^\d.]/g,'')" value="{$coupon.money}" class="input-txt">

                    <p class="notic">优惠券可抵扣金额</p>

                </dd>

            </dl>

            <dl class="row">

                <dt class="tit">

                    <label><em>*</em>消费金额</label>

                </dt>

                <dd class="opt">

                    <input type="text" id="condition" name="condition" value="{$coupon.condition}" onpaste="this.value=this.value.replace(/[^\d.]/g,'')" onkeyup="this.value=this.value.replace(/[^\d.]/g,'')" class="input-txt">

                    <p class="notic">订单需满足的最低消费金额(必需为整数)才能使用</p>

                </dd>

            </dl>

            <dl class="row">

                <dt class="tit">

                    <label><em>*</em>发放数量</label>

                </dt>

                <dd class="opt">

                    <input type="text" id="createnum" name="createnum" value="{$coupon.createnum}" onpaste="this.value=this.value.replace(/[^\d]/g,'')" onkeyup="this.value=this.value.replace(/[^\d]/g,'')" class="input-txt">

                    <p class="notic">发放数量限制(默认为0则无限制)</p>

                </dd>

            </dl>

            <dl class="row">

                <dt class="tit">

                    <label><em>*</em>链接</label>

                </dt>

                <dd class="opt">

                    <input type="text" name="coupon_url" value="{$coupon.coupon_url}" class="input-txt">

                    <p class="notic">优惠劵链接</p>

                </dd>

            </dl>

            <dl class="row">
                <dt class="tit"><em>*</em>优惠劵图片</dt>
                <dd class="opt">
                    <div class="input-file-show" id="divComUploadContainer">
            <span class="show">
                <a class="nyroModal" rel="gal" href="{$coupon.coupon_picurl}">
                    <i class="fa fa-picture-o" onMouseOver="layer.tips('<img src={$coupon.coupon_picurl}>',this ,{tips: [1, '#fff']});" onMouseOut="layer.closeAll();"></i>
                </a>
            </span>
            <span class="type-file-box">
            <input type="text" id="imagetext" name="coupon_picurl" value="{$coupon.coupon_picurl}" class="type-file-text">
            <input type="button" class="type-file-button" onClick="GetUploadify(1,'imagetext','goods','')" value="上传图片"  hidefocus="true" nc_type="change_site_logo" title="点击前方预览图可查看大图，点击按钮选择文件并提交表单后上传生效"/>
            </span>
                    </div>
                    <div id="thumbnails" class="ncap-thumb-list">
                        <h5><i class="fa fa-exclamation-circle"></i> 请上传图片格式文件。</h5>
                        <ul>
                        </ul>
                    </div>
                </dd>
            </dl>

            <dl class="row">

                <dt class="tit">

                    <label><em>*</em>发放类型</label>

                </dt>

                <dd class="opt">

                    <input name="type" type="radio" value="0" <if condition="$coupon['type'] eq 0">checked</if> ><label>面额模板</label>

                    <input name="type" type="radio" value="1" <if condition="$coupon['type'] eq 1">checked</if> ><label>按用户发放</label>

                    <input name="type" type="radio" value="2" <if condition="$coupon['type'] eq 2">checked</if> ><label>注册发放</label>

                    <input name="type" type="radio" value="3" <if condition="$coupon['type'] eq 3">checked</if> ><label>邀请发放</label>

                    <input name="type" type="radio" value="4" <if condition="$coupon['type'] eq 4">checked</if> ><label>线下发放</label>

                </dd>

            </dl>

            <dl class="row">

                <dt class="tit">

                    <label><em>*</em>发放起始日期</label>

                </dt>

                <dd class="opt">

                    <input type="text" id="send_start_time" name="send_start_time" value="{$coupon.send_start_time|date='Y-m-d H:i:s',###}"  class="input-txt">

                    <p class="notic">发放起始日期</p>

                </dd>

            </dl>

            <dl class="row timed">

                <dt class="tit">

                    <label><em>*</em>发放结束日期</label>

                </dt>

                <dd class="opt">

                    <input type="text" id="send_end_time" name="send_end_time" value="{$coupon.send_end_time|date='Y-m-d H:i:s',###}" class="input-txt">

                    <p class="notic">发放结束日期</p>

                </dd>

            </dl>

            <dl class="row timed">

                <dt class="tit">

                    <label><em>*</em>使用起始日期</label>

                </dt>

                <dd class="opt">

                    <input type="text" id="use_start_time" name="use_start_time" value="{$coupon.use_start_time|date='Y-m-d H:i:s',###}" class="input-txt">

                    <p class="notic">发放起始日期</p>

                </dd>

            </dl>

            <dl class="row">

                <dt class="tit">

                    <label><em>*</em>使用结束日期</label>

                </dt>

                <dd class="opt">

                    <input type="text" id="use_end_time" name="use_end_time" value="{$coupon.use_end_time|date='Y-m-d H:i:s',###}" class="input-txt">

                    <p class="notic">发放结束日期</p>

                </dd>

            </dl>

            <div class="bot"><a onclick="$('#handleposition').submit();" class="ncap-btn-big ncap-btn-green">确认提交</a></div>

        </div>

    </form>

</div>

<script type="text/javascript">

    $('input[type="radio"]').click(function(){

        if($(this).val() == 0){

            $('.timed').hide();

        }else{

            $('.timed').show();

        }

    })



    $(document).ready(function(){

        $('input[type="radio"]:checked').trigger('click');

        $('#send_start_time').layDate();

        $('#send_end_time').layDate();

        $('#use_start_time').layDate();

        $('#use_end_time').layDate();

    })



</script>

</body>

</html>